<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<script type="text/javascript">
    // 将远程数据加载到 xmlhttpRequeet load post get
	//页面加载完成后
	$(function() {
		//添加失焦事件
		$("#username").blur(function() {
			//获取录入的用户名
			var usernamevalue = $("#username").val();			
			//向服务器发送请求
			var url="/javaweb/load";
			//使用$.ajax完成操作
			$.ajax({
				url:"/javaweb/load",
				data:{'username':usernamevalue},
				type:"POST",
				dataType:"html",
				success:function(data){ //参数data它接收了服务器响应的数据
					$("#username_span").html(data);
				}
			});

			//load 将服务器返回html插入到指定标签中
			//$("#username_span").load(url,{"username":usernamevalue});
			
			
			//使用$.post完成操作
			//$.post(url,{"username":usernamevalue},function(data){
			//	$("#username_span").html(data);
			//},"html");
			
			//下面是$.get请求
			//$.get(url,{"username":usernamevalue},function(data){
				//$("#username_span").html(data);
			//},"html");
		});

		

	});
</script>
</head>
<body>

	用户名：<input type="text" name="username" id="username"><span id="username_span"></span>
	<br>
	密&nbsp;&nbsp;码：<input type="password" name="password">
	<br>

</body>
</html>